addEventHandler("onPlayerJoin", getRootElement(), function()
	spawnPlayer(source, math.random(0, 10), math.random(0, 10), 5, math.random(9, 299))
	setCameraTarget(source, source)
	fadeCamera(source, true, 5, 0, 0, 0)
end)

addEventHandler("onResourceStart", getResourceRootElement(), function()
	local PLAYERS = getElementsByType("player")
	for index, player in ipairs(PLAYERS) do
		--setElementPosition(player, math.random(0, 10), math.random(0, 10), 5)
		setElementModel(player, math.random(9, 299))
		setCameraTarget(player, player)
		fadeCamera(player, true, 5, 0, 0, 0)
		local r_r = math.random(0, 255)
		local r_g = math.random(0, 255) 
		local r_b = math.random(0, 255)
		setPlayerNametagColor(player, r_r, r_g, r_b)
	end
end)